﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        public static bool IsExecuted = true;
        public static string ExePath = "";
        private static Timer t1 = null;
        public static void ProcStart(bool IsExecutedI)
        {
            IsExecuted = IsExecutedI;
        }

        private void button1_Click(object sender, EventArgs e)
        {
//            Process.Start(@"C:\Windows\notepad.exe");
            MessageBox.Show(IsExecuted.ToString());
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (!IsExecuted)
              MessageBox.Show(IsExecuted.ToString());
            if (!IsExecuted)
            {
                Process.Start(ExePath);
                IsExecuted = true;
            }
        }

        private void Form1_Shown(object sender, EventArgs e)
        {
            t1 = timer1;
        }
    }
}
